package co.com.cdiweb;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import co.com.cdi.ejb.ClientMethodLocal;
import co.com.cdi.ejb.EJB2Local;
import co.com.cdi.ejb.EJBCDIParamLocal;
import co.com.cdi.ejb.EJBLocal;

/**
 * Servlet implementation class CDI
 */
@WebServlet("/CDI")
public class CDI extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CDI() {
        super();
        // TODO Auto-generated constructor stub
    }
    
    @EJB
    EJBLocal wine;
    
    @EJB
    EJB2Local wine2;
    
    @EJB
    EJBCDIParamLocal wineParam;
    
    @EJB
    ClientMethodLocal wineMethod;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		response.getWriter().println(wine.getColor() );
		response.getWriter().println(wine2.getColor());
		response.getWriter().println(wineParam.getColo());
		response.getWriter().println(wineMethod.getColor());
	}

}
